<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
		<script type="text/javascript" src="./jquery.js"></script>
		<title>
			Document
		</title>
	</head>
<?php 
	if($_POST){
		$a = $_POST['prev'];
		$b = $_POST['point'];
		$c = $_POST['next'];
		settype($a,'int');
		settype($c,'int');
		switch($b){
			case '*':
				$d = $a*$c;
				break;
			case '/':
				$d = $a/$c;
				break;	
			case '+':
				$d = $a+$c;
				break;
			case '-':
				$d = $a-$c;
				break;											
		}
	}

?>
	<body>
		
		<form action="" method="post">
			<input type="text" class="input" name="prev" value="<?php if(isset($a,$b,$c,$d)){
				echo "$a";
			} ?>"" />
			<select name="point">
				<option value="*">
					x
				</option>
				<option value="/">
					/
				</option>
				<option value="+">
					+
				</option>
				<option value="-">
					-
				</option>
			</select>
			<input type="text" class="input" name="next" value="<?php if(isset($a,$b,$c,$d)){
				echo "$c";
			} ?>"" />&nbsp;=&nbsp;
			<input type="text" disabled="disabled" name="value" id="" value="<?php if(isset($a,$b,$c,$d)){
				echo "$d";
			} ?>"/>
			<br />
			<input type="submit" name="submit" id="submit" value="计算" />
		</form>
	</body>

</html>
<script type="text/javascript">
	$(function(){
		$('.input').focusin(function(){
			$(this).removeAttr("value");		
		});
		
	});
</script>
